import Vue from 'vue';
import VueRouter from 'vue-router';
import store from '@/store/index'
import {Toast} from 'vant'
Vue.use(VueRouter);

const routes = [
  {
    path:'/',
    component:()=>import('@/views/home.vue')
  },
  {
    path:'/sy',
    component:()=>import('@/views/nr/sy'),
   
  },
  {
    path:'/fbfb',
    component:()=>import('@/views/fb/fbfb')
  },
  {
    path:'/wdwd',
    component:()=>import('@/views/wde/wdwd')
  },
  {
    path:'/ksss',
    component:()=>import('@/views/shosuo/ksss')
  },
  {
    path:'/dlu',
    component:()=>import('@/views/dlu/dlu')
  },
  {
    path:'/zc',
    component:()=>import('@/views/dlu/zc')
  },{
    path:'/xgmm',
    component:()=>import('@/views/dlu/xgmm'),
    meta:{
      qx:true
    }
  },{
    path:'/sswb',
    component:()=>import('@/views/shosuo/sswb')
  },{
    path:'/wdefb',
    component:()=>import('@/views/fb/wdefb')
  },{
    path:'/ppplll',
    component:()=>import('@/views/pldz/ppplll')
  },{
    path:'/Article',
    component:()=>import('@/views/wzwzwz/Article')
  },{
    path:'/xggrxx',
    component:()=>import('@/views/wde/grxx/xggrxx')
  },
  {
    path:'/sc',
    component:()=>import('@/views/wde/wdsc/sc')
  },
  {
    path:'/llls',
    component:()=>import('@/views/wde/llls/llls')
  },
  {
    path:'/wjmm',
    component:()=>import('@/views/dlu/wjmm')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
});
router.beforeEach((to, from, next) => {
         if(to.meta.qx){
          // let xsyc=store.state.mkhuser.xsyc
               if(store.state.mkhuser.xsyc){
                   next()
               }else{
                Toast('您还没有登录，请先登录')
                setTimeout(a=>{
                router.push('dlu')
                    
                },1000)
              
               }
         }else{
            next()
         }

})
export default router;
